<template>

  <div style="margin: auto; width: 100px; margin-top: 300px;" >
    <el-button type="success" @click="submit">下訂單</el-button>
  </div>

</template>

<script>
export default {
  name: "Order",
  methods: {
    submit() {
      this.$http.post("/order/").then((response) => {

        let result = response.data
        let orderId = result.orderId
        console.log(result)

        this.$message({
          message: result.msg,
          type: 'success'
        });

        setTimeout(() => {
          this.$router.push("/pay?orderId=" + orderId)
        }, 1000);

      });
    }
  }
}
</script>

<style scoped>

</style>
